package com.tuzki.zhuogui.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tuzki.zhuogui.core.Constants;

public class JoinGameRoom extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5426892841399066172L;

	@Override
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String userId = request.getParameter(Constants.KEY_USER_ID);
		String nickName = request.getParameter(Constants.KEY_NICK_NAME);
		String roomNumber = request.getParameter(Constants.KEY_ROOM_NUMBER);
		if (!checkRoomExist()) {
			response.getWriter().write(Constants.KEY_ROOM_UNEXIST);
		} else {
			joinGameRoom(userId, nickName, roomNumber);
			response.getWriter().write(roomNumber);
		}
	}

	private void joinGameRoom(String userId, String nickName, String roomNumber) {
		// TODO Auto-generated method stub
		
	}

	private boolean checkRoomExist() {
		return false;
	}

}
